<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.pulp.distribution.model.DistributionInfo"%>
<%@ page import="java.util.*"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.ResourceBundle"%>
<%@ page import="java.net.URLEncoder"%>
<%@ page import="java.util.StringTokenizer"%>
<%@ taglib prefix="sep" uri="/tags/sep"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>제품재고</TITLE>
<%
	System.out.println("===========In DistributionProductMaterial.jsp page==============");

	List<DistributionInfo> productInventoryYearList = (List) request.getAttribute("productInventoryYearList");
	List<DistributionInfo> productInventoryMonthList = (List) request.getAttribute("productInventoryMonthList");
	List<DistributionInfo> productInventoryDateList = (List) request.getAttribute("productInventoryDateList");

	if(productInventoryYearList != null) System.out.println("productInventoryYearList.size() is " + productInventoryYearList.size());
	
	for(int i = 0; i<productInventoryYearList.size(); i++){
		System.out.print(productInventoryYearList.get(i).getSection()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData1()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData2()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData3()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData4()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData5()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData6()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData7()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData8()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData9()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData10()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData11()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData12()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData13()+ "\t");
		System.out.print(productInventoryYearList.get(i).getData14()+ "\t");
		System.out.println(productInventoryYearList.get(i).getData15());
	}
	
	String strXML = "";

	Integer aaa = 10;

	strXML += "<chart palette='2' decimals='0' numdivlines='0' numberSuffix='' showLabels='1' animation='1' canvasBorderThickness='1'  canvasBorder='1'  showBorder='0' bgColor='#FFFFFF' sNumberSuffix='' setAdaptiveSYMin='1' showSum='1' showPlotBorder='1' useRoundEdges='0' showExportDataMenuItem='0'  showLegend='0' legendIconScale='20' legendPosition='right' legendCaption='alphabet'>";
	strXML += "<categories font='Arial' fontSize='12' fontColor='000000'>";
	for (Integer i = 1; i < 16; i++) {
		strXML += "	<category label='" + i + "'/>";
	}
	strXML += "</categories>";
	// strXML += "<dataset>";
	strXML += "	<dataSet seriesName='천안' color='#fef0df' showValues='1'>";
	strXML += "     <set value='10' />";
	strXML += "		<set value='26' />";
	strXML += "		<set value='29' />";
	strXML += "		<set value='31' />";
	strXML += "		<set value='34' />";
	strXML += "		<set value='26' />";
	strXML += "		<set value='29' />";
	strXML += "		<set value='31' />";
	strXML += "		<set value='34' />";
	strXML += "		<set value='31' />";
	strXML += "		<set value='34' />";
	strXML += "		<set value='26' />";
	strXML += "		<set value='29' />";
	strXML += "		<set value='31' />";
	strXML += "		<set value='34' />";
	strXML += "	</dataSet>";
	strXML += "	<dataSet seriesName='함안' color='F6BD0F'  showValues='1'>";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "	</dataSet>	";
	strXML += "	<dataSet seriesName='평택' color='A974A1'  showValues='1'>";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "		<set value='21' />";
	strXML += "		<set value='28' />";
	strXML += "		<set value='39' />";
	strXML += "		<set value='41' />";
	strXML += "		<set value='24' />";
	strXML += "	</dataSet>	";
	// strXML += "</dataset>	";

	strXML += "</chart>";

	String pieXML = "";

	pieXML += " <chart showPercentageInLabel='0' showValues='1' bgColor='#FFFFFF' showLabels='0' showBorder='0' showLegend='1' legendPosition='right'>";

	pieXML += " <set value='23' label='교체' color='429EAD'/>";

	pieXML += " <set value='12' label='정전' color='4249AD'/>";

	pieXML += " <set value='5' label='지연' color='AD42A2'/>";

	pieXML += " <set value='40' label='휴식' color='D4AC31'/>";

	pieXML += " </chart>";

	// System.out.println(strXML);
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="<sep:config key='server.config.doc-root'/>/css/style.css" rel="stylesheet">
<link rel="stylesheet" href="<sep:config key='server.config.doc-root'/>/css/dropkick.css" type="text/css">
<script type="text/javascript" src="<sep:config key='server.config.doc-root'/>/javascript/jquery-1.7.2.min.js"></script>
<script src="<sep:config key='server.config.doc-root'/>/javascript/jquery.dropkick-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="<sep:config key='server.config.doc-root'/>/javascript/SeJS.js"></script>
<script type="text/javascript" src="<sep:config key='server.config.doc-root'/>/javascript/FusionCharts.js"></script>
<script type="text/javascript">
	
	$(document).ready(function(){
		var divWidth = $("#container").width();
// 		alert(divWidth);
	});
	
	function init() {
		var context_root = "<sep:config key='server.config.doc-root'/>/FCharts/Charts/StackedColumn2D.swf";
		// 		FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect);
		var chart_test = new FusionCharts(context_root, "myChart", "1150", "350", "0", "0");
	    chart_test.setDataXML("<%=strXML%>");  
		chart_test.render("chart_test");
		
		var context_root1 = "<sep:config key='server.config.doc-root'/>/FCharts/Charts/Pie2D.swf";
		// 		FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect);
		var pie_test = new FusionCharts(context_root1, "myChart", "350", "350", "0", "0");
	    pie_test.setDataXML("<%=pieXML%>");
			pie_test.render("pie_test");

	}

	function radio(idx) {
// 		var year_style = document.getElementById("cntc_dat_year");
// 		var month_style = document.getElementById("cntc_dat_month");
// 		var day_style = document.getElementById("cntc_dat_day");

		if (idx == "1") {
// 			year_style.style.display = "";
// 			month_style.style.display = "";
// 			day_style.style.display = "";
			$("#year_box").show();
			$("#month_box").show();
			$("#date_box").show();
		} else if (idx == "2") {
// 			year_style.style.display = "";
// 			month_style.style.display = "";
// 			day_style.style.display = "none";
			$("#year_box").show();
			$("#month_box").show();
			$("#date_box").hide();
		} else {
// 			year_style.style.display = "";
// 			month_style.style.display = "none";
// 			day_style.style.display = "none";
			$("#year_box").show();
			$("#month_box").hide();
			$("#date_box").hide();
		}
	}
</script>

</HEAD>
<BODY onload="init()">
<div id="container">
<div id="summary">
<table>
<tr>
<td width="800">
				<div id="summary_tt">초지기 생산추이 <span></span></div>
				<span id="year_box">
					<select id="cntc_dat_year" class="" name="">
					</span>
					</select>
					<span id="month_box">
					<select id="cntc_dat_month" class="" name="">
					</span>
					</select>
					<span id="date_box">
					<select id="cntc_dat_day" class="" name="">
					</span>
						
					</select>
					</td>
				
				<td align="right" width="800">
				<span>
				<input type="radio" name="sample" value="date" checked="checked" onClick="radio(1);init();">일</input>&nbsp;&nbsp; 
				<input type="radio" name="sample" value="mon" onClick="radio(2);init();">월</input>&nbsp;&nbsp; 
				<input type="radio" name="sample" value="year" onClick="radio(3);init();">연</input>&nbsp;&nbsp; 
				<input type="image" src="<sep:config key='server.config.doc-root'/>/images/btn_search.gif"  style="cursor: pointer" onclick="init();" alt="조회">
				</span>
				</td>
				</tr>
				</table>
			</div>
			<div id="cont1">
			<table><tr><td>
			<div id="chart_test" style="margin-top: 0px;border:0" ></div></td>
			<td><div id="pie_test" style="margin-top: 0px;border:0" ></div><td>
			</tr>
			</table>
			</div>
<!-- 	<CENTER> -->
<!-- 		<div id="chart_test" style="margin-top: 0px;border:0" ></div> -->
<!-- 	</CENTER> -->
	<div id="cont2">
				<table class="table1">
					<thead>
					<tr>
						<th colspan="2" class="tbFirst">구분</th>
						<th>1</th>
						<th>2</th>
						<th>3</th>
						<th>4</th>
						<th>5</th>
						<th>6</th>
						<th>7</th>
						<th>8</th>
						<th>9</th>
						<th>10</th>
						<th>11</th>
						<th>12</th>
						<th>13</th>
						<th>14</th>
						<th>15</th>
					</tr>
					</thead>
					<tbody>
					<tr>
<!-- 						<td rowspan="8" class="green">평택</td> -->
						<td rowspan="4" class="green">생산<br>(톤)</td>
						<td class="green1">전체</td>
                        <td class="gray">52</td>
                        <td class="gray">82</td>
                        <td class="gray">107</td>
                        <td class="gray">113</td>
                        <td class="gray">82</td>
                        <td class="gray">68</td>
                        <td class="gray">85</td>
                        <td class="gray">109</td>
                        <td class="gray">116</td>
                        <td class="gray">79</td>
                        <td class="gray">76</td>
                        <td class="gray">82</td>
                        <td class="gray">107</td>
                        <td class="gray">113</td>
                        <td class="gray">82</td>
					</tr>
                    <tr>
						<td class="green">평택</td>
                        <td class="blue">21</td>
                        <td class="blue">28</td>
                        <td class="blue">39</td>
                        <td class="blue">41</td>
                        <td class="blue">24</td>
                        <td class="blue">21</td>
                        <td class="blue">28</td>
                        <td class="blue">39</td>
                        <td class="blue">41</td>
                        <td class="blue">24</td>
                        <td class="blue">21</td>
                        <td class="blue">28</td>
                        <td class="blue">39</td>
                        <td class="blue">41</td>
                        <td class="blue">24</td>
					</tr>
                    <tr>
						<td class="green">함안</td>
                        <td class="pink">21</td>
                        <td class="pink">28</td>
                        <td class="pink">39</td>
                        <td class="pink">41</td>
                        <td class="pink">24</td>
                        <td class="pink">21</td>
                        <td class="pink">28</td>
                        <td class="pink">39</td>
                        <td class="pink">41</td>
                        <td class="pink">24</td>
                        <td class="pink">21</td>
                        <td class="pink">28</td>
                        <td class="pink">39</td>
                        <td class="pink">41</td>
                        <td class="pink">24</td>
					</tr>
                    <tr>
						<td class="green">천안</td>
                        <td class="yellow">10</td>
                        <td class="yellow">26</td>
                        <td class="yellow">29</td>
                        <td class="yellow">31</td>
                        <td class="yellow">34</td>
                        <td class="yellow">26</td>
                        <td class="yellow">29</td>
                        <td class="yellow">31</td>
                        <td class="yellow">34</td>
                        <td class="yellow">31</td>
                        <td class="yellow">34</td>
                        <td class="yellow">26</td>
                        <td class="yellow">29</td>
                        <td class="yellow">31</td>
                        <td class="yellow">34</td>
					</tr>
					<tr>
						<td rowspan="4" class="green">운휴시간<br>(분)</td>
						<td class="green1">전체</td>
                        <td class="gray">150</td>
                        <td class="gray">60</td>
                        <td class="gray">150</td>
                        <td class="gray">60</td>
                        <td class="gray">40</td>
                        <td class="gray">70</td>
                        <td class="gray">165</td>
                        <td class="gray">80</td>
                        <td class="gray">90</td>
                        <td class="gray">70</td>
                        <td class="gray">110</td>
                        <td class="gray">140</td>
                        <td class="gray">150</td>
                        <td class="gray">170</td>
                        <td class="gray">170</td>
					</tr>
                    <tr>
						<td class="green">평택</td>
                        <td class="blue">150</td>
                        <td class="blue">60</td>
                        <td class="blue">150</td>
                        <td class="blue">60</td>
                        <td class="blue">40</td>
                        <td class="blue">70</td>
                        <td class="blue">165</td>
                        <td class="blue">80</td>
                        <td class="blue">90</td>
                        <td class="blue">70</td>
                        <td class="blue">110</td>
                        <td class="blue">140</td>
                        <td class="blue">150</td>
                        <td class="blue">170</td>
                        <td class="blue">170</td>
					</tr>
                    <tr>
						<td class="green">함안</td>
                        <td class="pink">150</td>
                        <td class="pink">60</td>
                        <td class="pink">150</td>
                        <td class="pink">60</td>
                        <td class="pink">40</td>
                        <td class="pink">70</td>
                        <td class="pink">165</td>
                        <td class="pink">80</td>
                        <td class="pink">90</td>
                        <td class="pink">70</td>
                        <td class="pink">110</td>
                        <td class="pink">140</td>
                        <td class="pink">150</td>
                        <td class="pink">170</td>
                        <td class="pink">170</td>
					</tr>
                    <tr>
						<td class="green">천안</td>
                        <td class="yellow">150</td>
                        <td class="yellow">60</td>
                        <td class="yellow">150</td>
                        <td class="yellow">60</td>
                        <td class="yellow">40</td>
                        <td class="yellow">70</td>
                        <td class="yellow">165</td>
                        <td class="yellow">80</td>
                        <td class="yellow">90</td>
                        <td class="yellow">70</td>
                        <td class="yellow">110</td>
                        <td class="yellow">140</td>
                        <td class="yellow">150</td>
                        <td class="yellow">170</td>
                        <td class="yellow">170</td>
					</tr>
					</tbody>
				</table>
			</div>
	
	</div>
<script type="text/javascript">
	var year = new Date().getFullYear();
	var month = new Date().getMonth() + 1;
	var date = nv.Dt.getLastDate(year, month);

	// 년 정의
	for ( var i = 0; i <= year - 2000; i++) {
		$("#cntc_dat_year").append(new Option(year - i, year - i, true, false));
	}
	$("#cntc_dat_year").dropkick();

	// 월 selectbox
	for ( var i = 0; i < 12; i++) {
		if ((month - 1) == i) {
			$("#cntc_dat_month").append(new Option(i + 1, i + 1, true, true));
		} else {
			$("#cntc_dat_month").append(new Option(i + 1, i + 1, true, false));
		}
	}
	// 월 selectbox
	$("#cntc_dat_month").dropkick({
		change : function(val, label) {
			$.ajax({
			type : "GET",
			url : "ajax_selectbox.html",
			data : {
			cntc_dat_year : val,
			cntc_dat_month : val
			},
			dataType : "html",
			success : function(msg) {
				$("#date_box").html(msg);
			}
			});
		}
	});
	// 일 selectbox
	for ( var i = 1; i <= date; i++) {
		if (new Date().getDate() == i) {
			$("#cntc_dat_day").append(new Option(i, i, true, true));
		} else {
			$("#cntc_dat_day").append(new Option(i, i, true, false));
		}
	}
	$("#cntc_dat_day").dropkick();
</script>	
</BODY>
</HTML>
